package meituan1.problem1;

import java.util.Arrays;
import java.util.Scanner;

/**
 *
 */
public class Main {
    /**
     * 如果不能拼成回文的话, 就把最高位变成0。
     * 变成回文串的话, 按照不同的两个里面小的那一个, 本身就是回文串的话, 就改中间的数。
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int totalNums = sc.nextInt();
        sc.nextLine();
        while(totalNums -- > 0){
            int curLen = sc.nextInt();
            sc.nextLine();
            int[] curArray = new int[curLen];
            String[] curStringArray = sc.nextLine().split("");
            for (int i = 0; i < curLen; i++) {
                curArray[i] = Integer.parseInt(curStringArray[i]);
            }
            int[] res = matchRule1(curArray);
            if(res != null){
                for(int i: res) System.out.print(i);
                System.out.println("");
            }else{
                here:
                for (int i = 0; i < curLen; i++) {
                    if(curArray[i] != 0){
                        curArray[i] = 0;
                        break here;
                    }
                }
                for(int i: curArray) System.out.print(i);
                System.out.println("");
            }


        }
    }
    public static int[] matchRule1(int[] curArray){
        int curLen = curArray.length;
        int diff = -1;
        for(int i = 0; i < curLen / 2; i++){
            if(curArray[i] != curArray[curLen - 1 - i]){
                if(diff != -1) return null;
                diff = i;
            }
        }
        if(diff == -1){
            if(curLen % 2 == 1){
                curArray[curLen / 2] = 0;
            }
            return curArray;
        }
        int min = Math.min(curArray[diff], curArray[curLen - 1 - diff]);
        curArray[diff] = min;
        curArray[curLen - 1 - diff] = min;
        return curArray;
    }
}
